// 静态路由配置
// 书写格式与动态路由格式一致，全部经由框架统一转换
// 比较动态路由在meta中多加入了role角色权限，为数组类型。一个菜单是否有权限显示，取决于它以及后代菜单是否有权限。
// routes 显示在左侧菜单中的路由(显示顺序在动态路由之前)
// import http from "@/utils/request"

const routes = [
    {
        name: "home",
        path: "/home",
        meta: {
            title: "首页",
            icon: "fe-airplay",
            type: "menu",
            moveable: false, //是否展示上下移动按钮
        },
        children: [{
            name: "dashboard",
            path: "/dashboard",
            meta: {
                title: "系统首页",
                icon: "el-icon-menu",
                affix: true,
                moveable: false, //是否展示上下移动按钮
                params: {id: 1} //传递参数,在页面中用 this.$route.meta.params 接收
            },
            component: "home"
        }]
    },
    {
        name: "appointment",
        path: "/appointment",
        meta: {
            title: "预约",
            icon: "fe-clock",
            type: "menu",
            role: ['appointment']
        },
        children: [
            {
                path: "/appointment/list",
                name: "appointment-list",
                meta: {
                    title: "预约管理",
                    icon: "fe-menu",
                    type: "menu",
                    role: ['appointment-list-view']
                },
                component: "appointment"
            },
            {
                path: "/record/order",
                name: "order",
                meta: {
                    title: "体验课订单",
                    icon: "fe-align-justify",
                    type: "menu",
                    role: ['record-transaction-view']
                },
                component: "transaction"
            }
        ]
    },
    {
        name: "record",
        path: "/record",
        meta: {
            title: "记录",
            icon: "fe-bar-chart-line",
            type: "menu",
            role: ['record']
        },
        children: [
            {
                path: "/record/learn",
                name: "record-learn",
                meta: {
                    title: "上课记录",
                    icon: "fe-align-justify",
                    type: "menu",
                    role: ['record-learn-view']
                },
                component: "learn"
            },
            {
                path: "/record/exam",
                name: "record-exam",
                meta: {
                    title: "测试记录",
                    icon: "fe-align-justify",
                    type: "menu",
                    role: ['record-exam-view']
                },
                component: "vocabularyExam"
            },
            {
                path: "/record/article",
                name: "record-article",
                meta: {
                    title: "阅读理解",
                    icon: "fe-align-justify",
                    type: "menu",
                    role: ['record-article-view']
                },
                component: "articleExercise"
            },
            {
                path: "/record/course",
                name: "record-course",
                meta: {
                    title: "语法课程",
                    icon: "fe-align-justify",
                    type: "menu",
                    role: ['record-learn-view']
                },
                component: "grammarCourse"
            },
            {
                path: "/record/recharge",
                name: "record-recharge",
                meta: {
                    title: "课时记录",
                    icon: "fe-align-justify",
                    type: "menu",
                    role: ['record-recharge-view']
                },
                component: "classHour/log"
            },
            {
				path: "/finance/log",
				name: "finance-log",
				meta: {
					title: "佣金记录",
					icon: "mdi mdi-playlist-check",
					type: "menu",
					role: ['record-finance-view']
				},
				component: "finance/log"
			},
            {
				path: "/finance/withdrawal",
				name: "finance-withdrawal",
				meta: {
					title: "提现管理",
					icon: "mdi mdi-sack",
					type: "menu",
					role: ['record-withdrawal-view']
				},
				component: "finance/withdrawal"
			},
        ]
    },
    {
        name: "user",
        path: "/user",
        meta: {
            title: "用户",
            icon: "fe-user",
            type: "menu",
            role: ['user']
        },
        children: [
            {
                path: "/user/list",
                name: "user-list",
                meta: {
                    title: "学员管理",
                    icon: "fe-users",
                    type: "menu",
                    role: ['users-user-view']
                },
                component: "user"
            },
            {
                path: "/grade/list",
                name: "grade-list",
                meta: {
                    title: "年级管理",
                    icon: "fe-list",
                    type: "menu",
                    role: ['users-grade-view']
                },
                component: "grade"
            },
        ]
    },
    {
        name: "agent",
        path: "/agent",
        meta: {
            title: "机构",
            icon: "fe-user",
            type: "menu",
            role: ['agent']
        },
        children: [
            {
                path: "/agent/list",
                name: "agent-list",
                meta: {
                    title: "机构列表",
                    icon: "fe-users",
                    type: "menu",
                    role: ['agent-list-view']
                },
                component: "agent"
            },
            {
                path: "/agent/audit/list",
                name: "agent-audit-list",
                meta: {
                    title: "开户申请",
                    icon: "fe-minimize",
                    type: "menu",
                    role: ['agent-audit-view']
                },
                component: "agent/agentAudit"
            },
            {
                path: "/agent/parnter/audit",
                name: "agent-parnter-audit",
                meta: {
                    title: "合伙人名额申请",
                    icon: "fe-compass",
                    type: "menu",
                    role: ['agent-partnerAudit-view']
                },
                component: "agent/parnterAudit"
            },
            {
                path: "/agent/level/list",
                name: "agent-level-list",
                meta: {
                    title: "机构等级管理",
                    icon: "fe-list",
                    type: "menu",
                    role: ['agent-level-view']
                },
                component: "agent/level"
            },
        ]
    },
    {
        name: "teacher",
        path: "/teacher",
        meta: {
            title: "教练",
            icon: "fe-user",
            type: "menu",
            role: ['teacher']
        },
        children: [
            {
                path: "/teacher/list",
                name: "teacher-list",
                meta: {
                    title: "教练列表",
                    icon: "fe-users",
                    type: "menu",
                    role: ['teacher-list-view']
                },
                component: "teacher"
            },
            {
                path: "/teacher/audit/list",
                name: "teacher-audit-list",
                meta: {
                    title: "教练审核",
                    icon: "fe-check-circle",
                    type: "menu",
                    role: ['teacher-audit-view']
                },
                component: "teacherAudit"
            },
            {
                path: "/teacher/title/list",
                name: "agent-title-list",
                meta: {
                    title: "教练头衔管理",
                    icon: "fe-align-right",
                    type: "menu",
                    role: ['teacher-title-view']
                },
                component: "teacher/title"
            },
            {
                path: "/teacher/rest/list",
                name: "agent-rest-list",
                meta: {
                    title: "休息时间申请管理",
                    icon: "fe-clock",
                    type: "menu",
                    role: ['teacher-rest-view']
                },
                component: "teacher/rest"
            }
        ]
    },
    {
        name: "course",
        path: "/course",
        meta: {
            title: "教学",
            icon: "el-icon-document",
            type: "menu",
            role: ['course']
        },
        children: [
            {
                path: "/course/list",
                name: "course-list",
                meta: {
                    title: "课程管理",
                    icon: "mdi mdi-bullseye",
                    type: "menu",
                    role: ['course-list-view']
                },
                component: "course"
            },
            {
                path: "/course/category/list",
                name: "course-category-list",
                meta: {
                    title: "课程类型管理",
                    icon: "mdi mdi-filter-variant",
                    type: "menu",
                    role: ['course-category-view']
                },
                component: "course/category"
            },
            {
                path: "/course/level/list",
                name: "course-level-list",
                meta: {
                    title: "课程学段管理",
                    icon: "mdi mdi-flare",
                    type: "menu",
                    role: ['course-level-view']
                },
                component: "course/level"
            },
            {
                path: "/course/difficulty/list",
                name: "course-difficulty-list",
                meta: {
                    title: "课程难度管理",
                    icon: "mdi mdi-source-branch",
                    type: "menu",
                    role: ['course-difficulty-view']
                },
                component: "course/difficulty"
            },
            {
                path: "/course/book/list",
                name: "course-book-list",
                meta: {
                    title: "教材管理",
                    icon: "mdi mdi-checkbook",
                    type: "menu",
                    role: ['course-book-view']
                },
                component: "course/book"
            },
            {
                path: "/course/material/list",
                name: "course-material-list",
                meta: {
                    title: "教学资料管理",
                    icon: "mdi mdi-format-list-bulleted",
                    type: "menu",
                    role: ['course-material-view']
                },
                component: "course/material"
            }
        ]
    },
    {
        name: "teaching",
        path: "/teaching",
        meta: {
            title: "流程",
            icon: "fe-cloud",
            type: "menu",
            role: ['teaching']
        },
        children: [{
            path: "/teaching/process",
            name: "teaching-process",
            meta: {
                title: "教学流程管理",
                icon: "fe-menu",
                type: "menu",
                role: ['teaching-process-view']
            },
            component: "teaching"
        }]
    },
    {
        name: "shop",
        path: "/shop",
        meta: {
            title: "营销",
            icon: "fe-cloud",
            type: "menu",
            role: ['product']
        },
        children: [{
            path: "/shop/product",
            name: "shop-product",
            meta: {
                title: "体验课管理",
                icon: "fe-menu",
                type: "menu",
                role: ['product-list-view']
            },
            component: "product"
        }]
    },
    {
        name: "salary",
        path: "/salary",
        meta: {
            title: "薪资",
            icon: "fe-pocket",
            type: "menu",
            role: ['salary']
        },
        children: [
            {
                path: "/salary/teacher/list",
                name: "salary-teacher-list",
                meta: {
                    title: "教练薪资管理",
                    icon: "fe-align-center",
                    type: "menu",
                    role: ['salary-teacher-view']
                },
                component: "salary/teacher"
            },
            {
                path: "/salary/teacher/calculate",
                name: "salary-teacher-calculate",
                meta: {
                    title: "薪资计算",
                    icon: "fe-dollar-sign",
                    type: "menu",
                    role: ['salary-calculate-view']
                },
                component: "salary/calculate"
            },
        ]
    },
    {
        name: "setting",
        path: "/setting",
        meta: {
            title: "配置",
            icon: "el-icon-setting",
            type: "menu",
            role: ['system']
        },
        children: [
        {
            path: "/setting/message",
            name: "setting-message",
            meta: {
                title: "消息管理",
                icon: "el-icon-chat-square",
                type: "menu",
                role: ['system-message-view']
            },
            component: "message"
        },
        {
            path: "/setting/vocabulary/rule",
            name: "setting-vocabulary-rule",
            meta: {
                title: "词汇量检测规则",
                icon: "fe-git-branch",
                type: "menu",
                role: ['system-vocabulary-view']
            },
            component: "vocabularyRule"
        },
        {
            path: '/setting/applyVersion',
            name: 'setting-applyVersion',
            meta: {
            title: 'APP更新',
            icon: 'mdi mdi-update',
            type: "menu",
            role: ['system-applyVersion-view']
            },
            component: "setting/applyVersion",
        },
        // {
        //     path: '/setting/classHourManagement',
        //     name: 'setting-classHourManagement',
        //     meta: {
        //         title: '课时管理',
        //         icon: 'fe-slack',
        //         type: "menu",
        //         role: ['system-applyVersion-view']
        //     },
        //     component: "setting/classHourManagement",
        // },
        {
            path: "/setting/user",
            name: "setting-user",
            meta: {
                title: "管理员管理",
                icon: "el-icon-user-solid",
                type: "menu",
                role: ['system-admin-view']
            },
            component: "setting/user"
        }, 
        {
            path: "/setting/role",
            name: "setting-role",
            meta: {
                title: "角色管理",
                icon: "el-icon-s-check",
                type: "menu",
                role: ['system-role-view']
            },
            component: "setting/role"
        },
        {
            path: "/setting/system",
            name: "setting-system",
            meta: {
                title: "系统配置",
                icon: "fe-settings",
                type: "menu",
                role: ['system-config-view']
            },
            component: "setting/system"
        },
        // {
        //     path: "/setting/operatopons",
        //     name: "setting-operatopons",
        //     meta: {
        //         title: "操作日志",
        //         icon: "fe-slack",
        //         type: "menu",
        //         //role: ['system-operations-view']
        //     },
        //     component: "operationLog"
        // }
        ]
    }
]

var _remoteRoute = []
export async function remoteRoute(reset = false) {

    if (_remoteRoute.length > 0 && ! reset) {
        return _remoteRoute
    }

    return routes;
}

export {
    routes,
};
